import React from "react";
import { Routes, Route } from "react-router-dom";
import BaseLayout from "@/layouts/BaseLayout";
import Home from "@/pages/Home/index";
import Goods from "@/pages/Goods/index";
import NotFound from "@/pages/ErrPage/404.tsx";
import DefautPage from "@/pages/DefautPage/index.tsx";
import Login from "@/pages/Login/index.tsx";


function RouterCom(): JSX.Element {
    // 重定向
    // function Redirect({string:to = ""}) {
    //     const navigate = useNavigate();
    //     useEffect(() => {
    //         navigate(to);
    //     });
    //     return null;
    // }

    return (
        <Routes>
            <Route path="login" element={<Login /> }></Route>
            <Route path="/"  element={<BaseLayout /> } >
                <Route index element={<DefautPage />} ></Route>
                <Route path="home" element={<Home />} ></Route>
                <Route path="system/goods" element={<Goods />} ></Route>
                <Route path="*" element={<NotFound />} />
            </Route>
        </Routes>
    );
}


{/* <Routes>
<Route path="/" element={<App />}>
  <Route index element={<Home />} />
  <Route path="teams" element={<Teams />}>
    <Route path=":teamId" element={<Team />} />
    <Route path="new" element={<NewTeamForm />} />
    <Route index element={<LeagueStandings />} />
  </Route>
</Route>
</Routes> */}

export default RouterCom;
